package com.senlingspace.common.enums;

/**
 * 购物车更新类型枚举
 *
 * @author lebronjames
 * @date 2024/10/03
 */
public enum CartUpdateTypeEnum {

    ADD(1010, "添加"),
    REDUCE(1011, "减少"),
    DELETE(1012, "删除");

    private final int code;
    private final String description;

    CartUpdateTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static CartUpdateTypeEnum fromCode(int code) {
        for (CartUpdateTypeEnum type : CartUpdateTypeEnum.values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }

}
